-
Notifications
You must be signed in to change notification settings - Fork 520
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[UIKit] Update for Xcode10. #4253
Conversation
src/UIKit/UIEnums.cs
Outdated
[Native] | ||
public enum UIPrintErrorCode : long | ||
{ | ||
ingNotAvailableError = 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ing
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ups, sorry.
src/spritekit.cs
Outdated
@@ -149,8 +149,13 @@ partial interface SKNode : NSSecureCoding, NSCopying { | |||
[return: NullAllowed] | |||
SKNode Create (string filename); | |||
|
|||
// new is needed after iOS 12 due to the new UIFocustItem protocol. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose the comment should say UIFocusItem
?
src/uikit.cs
Outdated
@@ -16687,6 +16732,15 @@ interface UIFocusItem : UIFocusEnvironment | |||
[Abstract] | |||
[Export ("canBecomeFocused")] | |||
bool CanBecomeFocused { get; } | |||
|
|||
[TV (12, 0), iOS (12, 0), NoWatch] | |||
[Abstract] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a breaking change: can't add new [Abstract]
members to an existing protocol.
It should go into a #if XAMCORE_4_0
block.
src/uikit.cs
Outdated
|
||
|
||
[TV (12, 0), iOS (12, 0)] | ||
[Abstract] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Breaking change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So XAMCORE_4_0 then
src/uikit.cs
Outdated
IUIFocusEnvironment ParentFocusEnvironment { get; } | ||
|
||
[TV (12, 0), iOS (12, 0)] | ||
[Abstract] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Breaking change.
src/uikit.cs
Outdated
interface UIFocusItemScrollableContainer : UIFocusItemContainer | ||
{ | ||
[Abstract] | ||
[TV(9,0), NoWatch] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The protocol itself is TV (12,0)
, but there are members with TV (9,0)
? That sounds strange (but otoh it wouldn't surprise me either...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, the protocol was added later, let me double check.
Build failure
|
@rolfbjarne changes pushed, added the #is statements and filled the rdars that have been added in the comments and in the trello board. |
Build failure
|
src/uikit.cs
Outdated
|
||
// FIXME: declared as a @required, but this breaks compatibilit | ||
// Radar: 41121416 | ||
#if XAMCORE_4_0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only the [Abstract]
need to be in XAMCORE_4_0
:
#if XAMCORE_4_0
[Abstract]
#endif
[TV (12, 0), iOS (12, 0), NoWatch]
[Export ("frame")]
CGRect Frame { get; }
src/uikit.cs
Outdated
@@ -5235,7 +5235,7 @@ interface UIDocument : NSFilePresenter, NSProgressReporting { | |||
|
|||
[iOS (8,0)] | |||
[Export ("restoreUserActivityState:")] | |||
void RestoreUserActivityState (NSUserActivity userActivity); | |||
new void RestoreUserActivityState (NSUserActivity userActivity); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you try locally to remove this method, so that we get the one from the protocol, and see what happens to the api diff? I think it won't be a breaking change, in which case it's better to remove it.
Build failure
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both intro and API Diff are reporting several issues.
src/uikit.cs
Outdated
@@ -6133,6 +6133,10 @@ interface UIGraphicsImageRendererFormat | |||
[Export ("opaque")] | |||
bool Opaque { get; set; } | |||
|
|||
[Introduced (PlatformName.iOS, 10, 0, message: "Use the 'PreferredRange' property instead.")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you don't need the Introduced
here
src/uikit.cs
Outdated
@@ -6133,6 +6133,10 @@ interface UIGraphicsImageRendererFormat | |||
[Export ("opaque")] | |||
bool Opaque { get; set; } | |||
|
|||
[Introduced (PlatformName.iOS, 10, 0, message: "Use the 'PreferredRange' property instead.")] | |||
[Deprecated (PlatformName.iOS, 12, 0, message: "Use the 'PreferredRange' property instead.")] | |||
[Introduced (PlatformName.TvOS, 10, 0, message: "Use the 'PreferredRange' property instead.")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
src/uikit.cs
Outdated
CGSize VisibleSize { get; } | ||
} | ||
|
||
[iOS (8,0), TV (8,0), NoWatch] // it was added on 8,0, but was not binded and the method was added in 12,0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tvOS started with 9.0 so remove it's attribute (which means it's always been available)
src/uikit.cs
Outdated
[Field ("UIKitVersionString")] | ||
NSString UIKitVersionString { get; } | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove those and put them in UIKit.ignore
we're doing the same in other semi-versioned frameworks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me after Sebastien and Rolf comments are addressed.
src/spritekit.cs
Outdated
@@ -149,8 +149,10 @@ partial interface SKNode : NSSecureCoding, NSCopying { | |||
[return: NullAllowed] | |||
SKNode Create (string filename); | |||
|
|||
#if MONOMAC || WATCH |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand that change. I believe this is a breaking change. Also I'm confused about a SpriteKit change in this UIKit PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it is not. In iOS and TV we have the IUIFocusItem interface that already contains the Frame property. That means that in those platforms, it can be removed.
On WatchOS and MacOS we do not have that interface, therefore the property does not get generated and you have to add it manually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@VincentDondain once the build is done, take a look at the api diff and the Extrospection results both confirm my statement :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah got it, didn't realize it was in IUIFocusItem
👍
Build failure
|
Build failure
|
Build failure
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good but please check/fix/comment on bot failures before merging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM when breaking change is addressed (:
src/uikit.cs
Outdated
@@ -16687,6 +16719,19 @@ interface UIFocusItem : UIFocusEnvironment | |||
[Abstract] | |||
[Export ("canBecomeFocused")] | |||
bool CanBecomeFocused { get; } | |||
|
|||
// FIXME: declared as a @required, but this breaks compatibilit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor typo: "compatibility"
@@ -9862,10 +9872,6 @@ interface UIResponder : UIAccessibilityAction, UIAccessibilityFocus | |||
[Export ("updateUserActivityState:")] | |||
void UpdateUserActivityState (NSUserActivity activity); | |||
|
|||
[iOS (8,0)] | |||
[Export ("restoreUserActivityState:")] | |||
void RestoreUserActivityState (NSUserActivity activity); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah the argument here was activity
and not userActivity
therefore removing it and using the interface is a breaking change...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mmm, we have allowed parameter name changes in the past, but since the UIUserActivityRestoring
protocol just got added lets just rename userActivity
to activity
to avoid the breaking change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, also, braking change is probably a too "strong" adjective. API will change, not break ;)
Doing it nevertheless
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a breaking change because of named parameters for example if anyone is doing RestoreUserActivityState (activity: x); it would not compile anymore, but yeah not very likely
[Export ("contentSize")] | ||
CGSize ContentSize { get; set; } | ||
new CGSize ContentSize { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be removed as well, so that we get it from UIFocusItemScrollableContainer
instead, or will the api diff complain?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, in this case the protocol just exposes the get, but not the set.
@@ -12995,7 +12998,7 @@ interface UIView : UIAppearance, UIAppearanceContainer, UIAccessibility, UIDynam | |||
CoreAnimation.CALayer Layer { get; } | |||
|
|||
[Export ("frame")] | |||
CGRect Frame { get; set; } | |||
new CGRect Frame { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same: can this be removed as well, so that we get it from UIFocusItemContainer
instead, or will the api diff complain?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same, protocol just exposes get, not set.
@@ -9862,10 +9872,6 @@ interface UIResponder : UIAccessibilityAction, UIAccessibilityFocus | |||
[Export ("updateUserActivityState:")] | |||
void UpdateUserActivityState (NSUserActivity activity); | |||
|
|||
[iOS (8,0)] | |||
[Export ("restoreUserActivityState:")] | |||
void RestoreUserActivityState (NSUserActivity activity); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mmm, we have allowed parameter name changes in the past, but since the UIUserActivityRestoring
protocol just got added lets just rename userActivity
to activity
to avoid the breaking change.
src/uikit.cs
Outdated
[Abstract] | ||
[iOS (8,0), TV(12,0)] | ||
[Export ("restoreUserActivityState:")] | ||
void RestoreUserActivityState (NSUserActivity userActivity); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename userActivity
to activity
to avoid a breaking change.
Build success
|
Build success
|
This is an update for the Xcode 10. I am interested in input regarding the addition of the new protocols that have been added with old methods (already present) and new ones:
I added the methods in the protocols with the correct signature, left the methods in the old interfaces and added new to ignore errors. Comments are welcome regarding this approach.
Diffs are: